#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+10,MOD = 1e9+7;
int minP[N];
int mu[N];
int sig[N];
int pv[N];
int m;
void init(){
    vector<int> p;
    mu[1] = 1;
    sig[1] = 1;
    for(int i = 2;i <= m;i++){
        if(!minP[i]){
            minP[i] = i;
            mu[i] = -1;
            pv[i] = i;
            sig[i] = 2;
            p.push_back(i);
        }
        for(int j = 0;1ll*p[j]*i <= m && minP[i] != p[j];j++){
            minP[i*p[j]] = p[j];
            pv[i*p[j]] = p[j];
            mu[i*p[j]] = -mu[i];
            sig[i*p[j]] = sig[i]*2;
        }
        if(1ll*i*minP[i] <= m){
            minP[i*minP[i]] = minP[i];
            pv[i*minP[i]] = minP[i]*pv[i];
            sig[i*minP[i]] = sig[i] + sig[i/pv[i]];
        }
    }
    for(int i = 1;i<=m;i++){
        sig[i] = (sig[i - 1] + sig[i])%MOD;
        mu[i] = (mu[i - 1] + mu[i])%MOD;
    }
}
unordered_map<int,int> mmp;
int query_sum_mu(int p){
    if(p <= m){
        return mu[p];
    }
    if(mmp.count(p)){
        return mmp[p];
    }
    int r = 0;
    int res = 1;
    for(int l = 2;l <= p;l = r + 1){
        r = min(p/(p/l),p);
        res = (res + MOD - 1ll*(r - l + 1)*query_sum_mu(p/l)%MOD)%MOD;
    }
    mmp[p] = res;
    return res;
}
unordered_map<int,int> smp;
int query_sum_sig(int p){
    if(p <= m){
        return sig[p];
    }
    if(smp.count(p)){
        return smp[p];
    }
    int r = 0;
    int res = p;
    for(int l = 2;l <= p;l = r + 1){
        r = min(p/(p/l),p);
        res = (res + MOD - 1ll*(query_sum_mu(r) - query_sum_mu(l - 1) + MOD)%MOD*query_sum_sig(p/l)%MOD)%MOD;
    }
    smp[p] = res;
    return res;
}
int main(){
    int n;  
    cin>>n;
    m = pow(4ll*n,0.6);
    init();
    int res = 0;
    int r = 0;
    for(int l = 1;l <= n;l = r + 1){
        r = min(n/(n/l),n);
        res = (res + 1ll*(query_sum_mu(r) - query_sum_mu(l - 1) + MOD)%MOD*query_sum_sig(n/l)%MOD*query_sum_sig(n/l)%MOD)%MOD;
    }
    cout<<res<<'\n';
}